home *** CD-ROM | disk | FTP | other *** search
/ Gekikoh Dennoh Club 1 / Gekikoh Dennoh Club Vol. 1 (Japan).7z / Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin / kowin / archive / net / k20menus.lzh / k20pop.c < prev    next >
C/C++ Source or Header  |  1994-09-10  |  3KB  |  171 lines

  1. /*    Copyright 1992 H.Ogasawara (COR.)    */
  2. #include    <corlib.h>
  3. #include    "k20menu.h"
  4.  
  5. extern int    font;
  6. extern int    autoexit,
  7.         ncflag;
  8. extern short    dspmode;
  9. extern WindowID    Awp, Bwp;
  10. extern unsigned char    **lp;
  11. extern NET_MENU    *top;
  12.  
  13. static char    *menu[]= {
  14.             "最終LOG表示",
  15.             "最終LOG新規",
  16.             "表示:月集計",
  17.             "表示:最終値",
  18.             "表示:電  話",
  19.             "表示:RS/LOG",
  20.             "表示:モデム",
  21.             "表示:手  順",
  22.             "NET設定修正",
  23.         }/*, *menu2[]= {
  24.             "表示:月集計",
  25.             "表示:最終値",
  26.             "表示:電  話",
  27.             "表示:RS/LOG",
  28.             "表示:モデム",
  29.             "表示:手  順",
  30.             "NET設定追加",
  31.         }*/;
  32.  
  33. #define        menus    (sizeof(menu)/sizeof(char*))
  34. #define        menus2    (sizeof(menu2)/sizeof(char*))
  35.  
  36. static char    View[]= "view.win";
  37.  
  38. getdate( buf )
  39. char    *buf;
  40. {
  41.     DATEASC( (DATEBIN(BINDATEGET())&0x0fffffff)+0x30000000, buf );
  42. }
  43.  
  44. getlog( buf2, n )
  45. unsigned char    *buf2;
  46. {
  47.     NET_MENU    *net= (NET_MENU*)net_count( n );
  48.     if( net && *net->lastlogin ){
  49.         unsigned char    buf[256];
  50.         unsigned char    buf1[20];
  51.         unsigned char    *ptr, *str;
  52.         ngetword( buf, net->line, 5 );
  53.         for( str= buf2, ptr= buf ; *ptr ; ptr++ ){
  54.             switch( *ptr ){
  55.             case '*':
  56.                 /*getdate( buf1 );*/
  57.                 *str++= net->lastlogin[0];
  58.                 *str++= net->lastlogin[1];
  59.                 *str++= net->lastlogin[3];
  60.                 *str++= net->lastlogin[4];
  61.                 *str++= net->lastlogin[6];
  62.                 *str++= net->lastlogin[7];
  63.                 break;
  64.             case '@':
  65.                 /*getdate( buf1 );*/
  66.                 *str++= net->lastlogin[3];
  67.                 *str++= net->lastlogin[4];
  68.                 *str++= net->lastlogin[6];
  69.                 *str++= net->lastlogin[7];
  70.                 break;
  71.             case '\\':
  72.                 if( *++ptr == '$' && *++ptr == '(' ){
  73.                     unsigned char    *r= buf1,
  74.                             ebuf[256];
  75.                     for(;*ptr && *ptr!=')'; *r++=*ptr++ );
  76.                     *r= '\0';
  77.                     if( GETENV( buf1, NULL, ebuf )>=0 ){
  78.                         str= (void*)astrcpy( str, ebuf );
  79.                     }
  80.                 }else
  81.                     *str++= *ptr;
  82.                 break;
  83.             default:
  84.                 *str++= *ptr;
  85.             }
  86.         }
  87.         *str= '\0';
  88.         return    TRUE;
  89.     }
  90.     return    FALSE;
  91. }
  92.  
  93. log_view( n, flag )
  94. {
  95.     int    i;
  96.     EventInfo    info;
  97.     unsigned char    log[256];
  98.     if( !getlog( log, n ) )
  99.         return;
  100.     if( flag && (i= PidSearch( View, 1 )) ){
  101.         static unsigned char    *vbuf[2]= { NULL, NULL };
  102.         vbuf[0]= log;
  103.         info.option= EventUser;
  104.         info.ComData= UserStrings;
  105.         info.ComBuffer= vbuf;
  106.         WindowSendEventAll( i, &info );
  107.         return;
  108.     }
  109.     WindowLoadExec( View, log, NULL, NULL );
  110. }
  111.  
  112. log_edit( n )
  113. {
  114.     int    i;
  115.     EventInfo    info;
  116.     unsigned char    log[256],
  117.             Edit[256];
  118.     if( !getlog( log, n ) )
  119.         return;
  120.     if( GETENV( "KOEDITOR", Edit, 0 ) < 0 )
  121.         strcpy( Edit, "ke.win" );
  122.     WindowLoadExec( Edit, log, NULL, NULL );
  123. }
  124.  
  125. p_menu( n )
  126. {
  127.     int    i, x, y;
  128.     EventInfo    info;
  129.     WindowGetEventInfo( &info );
  130.     if( n < 256 )
  131.         i= PopUpMenu( info.x-2, info.y+1, menu, menus, 12 );
  132. #if 0
  133.     else{
  134.         i= PopUpMenu( info.x-2, info.y+1, menu2, menus2, 12 );
  135. /*        if( i == 6 )
  136.             i= 10;
  137.         else */if( i >= 0 && i <= 6 )
  138.             i+= 2;
  139.     }
  140. #endif
  141.     switch( i ){
  142.     case 0:
  143.         log_view( n, TRUE );
  144.         break;
  145.     case 1:
  146.         log_view( n, FALSE );
  147.         break;
  148.     case 2:
  149.     case 3:
  150.     case 4:
  151.     case 5:
  152.     case 6:
  153.     case 7:
  154.         dspmode= i-2;
  155.         make_line( top, lp );
  156.         WindowRedraw( Awp );
  157.         break;
  158.     case 8:
  159.     case 9:
  160.     case 10:
  161.         if( n < 256 ){
  162.             NET_MENU    *net= (NET_MENU*)net_count( n );
  163.             if( net )
  164.                 OpenDiag( info.x-2, info.y+1, net->line );
  165.         }else
  166.             OpenDiag( info.x-2, info.y+1, "" );
  167.         break;
  168.     }
  169. }
  170.  
  171.